package com.vctgo.certificate.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.vctgo.certificate.mapper.TbCertificateMapper;
import com.vctgo.certificate.domain.TbCertificate;
import com.vctgo.certificate.service.ITbCertificateService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vctgo.common.core.text.Convert;
import com.vctgo.common.core.utils.ServletUtils;
import com.vctgo.common.mybatisplus.constant.MybatisPageConstants;
/**
 * 凭证字Service业务层处理
 *
 * @author vctgo
 * @date 2024-12-16
 */
@Service
public class TbCertificateServiceImpl implements ITbCertificateService
{
    @Autowired
    private TbCertificateMapper tbCertificateMapper;

    /**
     * 查询凭证字
     *
     * @param id 凭证字主键
     * @return 凭证字
     */
    @Override
    public TbCertificate selectTbCertificateById(Long id)
    {
        return tbCertificateMapper.selectById(id);
    }

    /**
     * 查询凭证字列表-分页
     *
     * @param tbCertificate 凭证字
     * @return 凭证字
     */
    @Override
    public IPage<TbCertificate> selectTbCertificatePage(TbCertificate tbCertificate)
    {
        Page mpPage =new Page(Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_NUM),1L)
                ,Convert.toLong(ServletUtils.getParameterToInt(MybatisPageConstants.PAGE_SIZE),10L));
        return tbCertificateMapper.selectTbCertificateList(mpPage,tbCertificate);
    }
    /**
     * 查询凭证字列表
     *
     * @param tbCertificate 凭证字
     * @return 凭证字
     */
    @Override
    public List<TbCertificate> selectTbCertificateList(TbCertificate tbCertificate)
    {
        return tbCertificateMapper.selectTbCertificateList(tbCertificate);
    }

    /**
     * 新增凭证字
     *
     * @param tbCertificate 凭证字
     * @return 结果
     */

    @Override
    public int insertTbCertificate(TbCertificate tbCertificate)
    {
        return tbCertificateMapper.insert(tbCertificate);
    }

    /**
     * 修改凭证字
     *
     * @param tbCertificate 凭证字
     * @return 结果
     */
    @Override
    public int updateTbCertificate(TbCertificate tbCertificate)
    {
        return tbCertificateMapper.updateById(tbCertificate);
    }

    /**
     * 批量删除凭证字
     *
     * @param ids 需要删除的凭证字主键
     * @return 结果
     */
    @Override
    public int deleteTbCertificateByIds(Long[] ids)
    {
        return tbCertificateMapper.deleteTbCertificateByIds(ids);
    }

    /**
     * 删除凭证字信息
     *
     * @param id 凭证字主键
     * @return 结果
     */
    @Override
    public int deleteTbCertificateById(Long id)
    {
        return tbCertificateMapper.deleteById(id);
    }
}
